package com.yukh.test.javabase.thread.concurrent;

import java.util.concurrent.ArrayBlockingQueue;

import org.junit.Test;

public class ArrayBlockingQueueDemo {
	
	@Test
	public void add(){
		try {
			ArrayBlockingQueue<String> array = new ArrayBlockingQueue<String>(200);
			for(int i=0, n=50; i<n; i++){
				array.put(String.valueOf(i));
			}
			if(array.size() > 49){
				for(int i=0, n=20; i<n; i++){
					System.out.println(array.poll());
				}
			}
			System.out.println("");
		} catch (Exception e) {
			e.printStackTrace();
		}
		
	}
}
